package cn.iocoder.yudao.module.course.dal.mysql.lessoncourse;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.course.dal.dataobject.lessoncourse.LessonCourseDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.course.controller.admin.lessoncourse.vo.*;

/**
 * 课时管理， 每个课程里面多少个课时 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface LessonCourseMapper extends BaseMapperX<LessonCourseDO> {

    default PageResult<LessonCourseDO> selectPage(LessonCoursePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LessonCourseDO>()
                .eqIfPresent(LessonCourseDO::getLessonCode, reqVO.getLessonCode())
                .eqIfPresent(LessonCourseDO::getCourseCode, reqVO.getCourseCode())
                .likeIfPresent(LessonCourseDO::getCourseName, reqVO.getCourseName())
                .likeIfPresent(LessonCourseDO::getCourseDesc, reqVO.getCourseDesc())
                .betweenIfPresent(LessonCourseDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LessonCourseDO::getId));
    }

    default List<LessonCourseDO> selectList(LessonCourseExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<LessonCourseDO>()
                .eqIfPresent(LessonCourseDO::getLessonCode, reqVO.getLessonCode())
                .eqIfPresent(LessonCourseDO::getCourseCode, reqVO.getCourseCode())
                .likeIfPresent(LessonCourseDO::getCourseName, reqVO.getCourseName())
                .likeIfPresent(LessonCourseDO::getCourseDesc, reqVO.getCourseDesc())
                .betweenIfPresent(LessonCourseDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LessonCourseDO::getId));
    }

}
